<?php

namespace app\admin\model\system;

use think\Model;


class Level extends Model
{

    

    

    // 表名
    protected $name = 'system_level';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'advertdata_text',
        'displaydata_text',
        'avadata_text'
    ];
    

    
    public function getAdvertdataList()
    {
        return ['1' => __('Advertdata 1'), '2' => __('Advertdata 2')];
    }

    public function getDisplaydataList()
    {
        return ['1' => __('Displaydata 1'), '2' => __('Displaydata 2')];
    }

    public function getAvadataList()
    {
        return ['1' => __('Avadata 1'), '2' => __('Avadata 2')];
    }


    public function getAdvertdataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['advertdata']) ? $data['advertdata'] : '');
        $list = $this->getAdvertdataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getDisplaydataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['displaydata']) ? $data['displaydata'] : '');
        $list = $this->getDisplaydataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getAvadataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['avadata']) ? $data['avadata'] : '');
        $list = $this->getAvadataList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
